import PropTypes from 'prop-types'
import React, { memo } from 'react'
import { SectionWraper } from './style'

const SectionHeader = memo((props) => {
  const { title,subtitle } = props
  return (
    <SectionWraper>
      <h2 className="title">{title}</h2>
      { subtitle && <h2 className='subtitle'>{subtitle}</h2>}
    </SectionWraper>
  )
})

// propTypes 是 对 父组件 传过来的值 做类型验证 
SectionHeader.propTypes = {
  title:PropTypes.string,
  subtitle:PropTypes.string
}

export default SectionHeader
